<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>华胜后台管理</title>
<link rel="stylesheet" type="text/css" href="css/unified.css">
<script src="plugins/layui/layui.js"></script>

<style type="text/css">
.searchform span {
	margin-left: 10px
}

.layui-table-view .layui-table td,
.layui-table-view .layui-table th {
	padding: 0
}.layui-col-md6,
.layui-col-md4,
.layui-col-md12 {
	padding: 0 10px;
}

.layui-form-pane .layui-form-label {
	width: 134px;
}

.layui-form-pane .layui-input-block {
	margin-left: 134px;
}
</style>
</head>
<body>
<!----------------------面包屑导航 --------------------->
<div class="breadcrumbnav">
<span class="layui-breadcrumb " lay-separator="·">
  <a ><cite>首页</cite></a>
  <a ><cite>库存管理</cite></a>
  <a ><cite>采购入库</cite></a>
</span>
</div>
<!----------------------面包屑导航 end--------------------->

<div class="kit-doc">
<!------------- 标题 ---------------->
<div class="kit-doc-title">
<fieldset><legend><a name="blockquote">入库</a></legend></fieldset>
</div>
<!---------------- 标题 end ---------------->


<!---------------- 内容 ---------------->
<div class="boderbox">
<div class="rowtop">
<button class="layui-btn addbtn openwinbtn" data-method="addmang">
添加+
</button>
<!------------------ 搜索 ------------------>
<!--<form class="layui-form searchform" action="" id="comSearchForm">
    <div class="layui-input-inline">
      <span class="layui-input-inline">供货单位:</span>
      <select name="city" lay-verify="" >
        <option value="010">彬彬木业</option>
        <option value="021">彬彬木业</option>
        <option value="0571" selected>layim</option>
      </select> 
    </div>

    <span class="layui-input-inline">经手人:</span>
    <select name="city" lay-verify=""  >
      <option value="010">彬彬木业</option>
      <option value="021">彬彬木业</option>
      <option value="0571" selected>layim</option>
    </select>   
    <span class="layui-input-inline">部门:</span>
    <select name="city" lay-verify="" >
      <option value="010">彬彬木业</option>
      <option value="021">彬彬木业</option>
      <option value="0571" selected>layim</option>
    </select>   
    <span >付款日期:</span>
    
      <input type="text" class=" paydata" id="test1">  
   
    
    <span class="layui-input-inline">收货仓库:</span>
    <select name="city" lay-verify="" >
      <option value="010">彬彬木业</option>
      <option value="021">彬彬木业</option>
      <option value="0571" selected>layim</option>
    </select> 
</form> -->
<!------------------搜索 end------------------>
</div>
   
    <div class="layui-tab-content notab">
<div class="layui-tab-item layui-show">
 <table  class="layui-table " lay-filter="table100" id="SAtable"></table>
</div>
  </div>
<!------------------底部按钮 ------------------>
<!--<div class="rowbottom rightrow">

<div class="layui-btn-group">
  <button class="layui-btn openwinbtn" data-method="openstock">开单</button>
  <button class="layui-btn layui-btn-normal">打单</button>
</div>
</div>-->
<!------------------底部按钮 end------------------>

<script id="addBox" type="text/html">
	<div class=" layui-layer-wrap">
		<form class="layui-form layui-form-pane" action="" id="addform">
	
			<div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
				<div class="layui-form-item">
					<label class="layui-form-label">库存地点</label>
					<div class="layui-input-block">
						<input type="text" name="locationId" autocomplete="off" placeholder="" class="layui-input">
					</div>
				</div>
			</div>
			<div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
				<div class="layui-form-item">
					<label class="layui-form-label">库存数量</label>
					<div class="layui-input-block">
						<input type="text" name="theNum" autocomplete="off" placeholder="" class="layui-input">
					</div>
				</div>
			</div>
			<div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
				<div class="layui-form-item">
					<label class="layui-form-label">库存最后改动人</label>
					<div class="layui-input-block">
						<input type="text" name="updateId" autocomplete="off" lay-verify="required" placeholder="" class="layui-input">
	
					</div>
				</div>
			</div>

			<div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
				<div class="layui-form-item">
					<label class="layui-form-label">商品数量</label>
					<div class="layui-input-block">
						<input type="text" id="commodityNumber" name="registerTime" class="layui-input">
					</div>
				</div>
			</div>
			<div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
				<div class="layui-form-item">
					<label class="layui-form-label">产品条形码</label>
					<div class="layui-input-block">
						<input type="text" name="barCode" autocomplete="off" lay-verify="required" placeholder="" class="layui-input">
					</div>
				</div>
			</div>
		
			<div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
				<div class="layui-form-item">
					<label class="layui-form-label">商家编号</label>
					<div class="layui-input-block">
						<input type="text" name="merchantNumber" lay-verify="required" autocomplete="off" class="layui-input" placeholder="">
					</div>
				</div>
			</div>
			<div class="layui-col-xs12 layui-col-sm6 layui-col-md6">
				<div class="layui-form-item">
					<label class="layui-form-label">商品id</label>
					<div class="layui-input-block">
						<input type="text" name="commodityId" autocomplete="off" class="layui-input" placeholder="">
					</div>
				</div>
			</div>
	
			
		</form>
		
	</div>
	
	</script>


<script type="text/html" id="barDemo">
  <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
</script>


<script src="js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="js/allajax.js"></script>
<script>
var tableArray = new Array();
layui.use(['layer', 'form', 'element', 'table', 'laydate'], function() {
var layer = layui.layer,
	form = layui.form,
	element = layui.element,
	table = layui.table,
	laydate = layui.laydate;
laydate.render({
	elem: '#test1' //指定元素
});

stockAddlist( 1 , 100 , '{}')
function stockAddlist(page , pagesize , thisjson){
	

AjaxPostFn('system/repository/in/select?page='+page+'&pagesize='+pagesize, thisjson, function(jsonData) {
 if(jsonData.pageInfo.size!=0){

$.each(jsonData.pageInfo.list, function(i, obj) {
	if(obj.bizRepositoryIn != null){
		objIn = obj.bizRepositoryIn;
		objVo = obj.bizCommodityVo;
		tableArray.push({
	//    "id": obj.id,
	    "operation": "<a class='layui-btn layui-bg-red ' lay-event='DelThis'>删除</a>",
	//        "locationId":obj.locationId ,
	//        "theNum": obj.theNum,
	//        "updateId": obj.updateId,
	//        "updateTime": obj.updateTime,
	//        "commodityNumber": obj.commodityNumber,
	//        "barCode": obj.barCode,
	//        "createTime": obj.createTime,
	//        "merchantNumber":obj.merchantNumber ,
	//        "commodityId": obj.commodityId,
	//        "bizRepository":obj.bizRepository,
	//        "bizCommodityVo": obj.bizCommodityVo,
	//        "bizRepositoryPrepareOrder":obj.bizRepositoryPrepareOrder
			 "id": objIn.id,
	          "batchId": objIn.batchId,
	          "locationId": objIn.locationId,
	          "theNum": objIn.theNum,
	          "supplierName": objIn.supplierName,
	          "supplierContact": objIn.supplierContact,
	          "supplierPhone": objIn.supplierPhone,
	          "averagePrice": objIn.averagePrice,
	          "expireTime":objIn.expireTime,
	          "comment": objIn.comment,
	          "createId": objIn.createId,
	          "createTime": getMyDate( objIn.createTime),
	          "commodityId": objIn.commodityId,
	          "merchantNumber": objIn.merchantNumber,
	          "commodityNumber": objIn.commodityNumber,
	          "barCode": objIn.barCode,
	          
	          //商品基础信息
	          
                "commodityBrand":objVo.commodityBrand,
                "commodityName":objVo.commodityName,
                "commodityModel":objVo.commodityModel ,
                "commodityOrigin":objVo.commodityOrigin ,
                "commodityWeigh":objVo.commodityWeigh ,
                "commodityUnit":objVo.commodityUnit ,
                "commoditySet":objVo.commoditySet ,
                "vohomePhoto":"<img src='"+IMGUrl +'' +  objVo.homePhoto + "' alt='商品图片' class='classifyimg'>",

	         
	    });
	}
	
})
}

//展示已知数据
table.render({
	elem: '#SAtable',
cols: [
	[ //标题栏

    {field: 'id',minWidth: '0%',width: '0%',type: 'space',style: 'display:none'}, 
    {field: 'operation',width: 100,title: '操作',fixed: 'left'},
    {field: 'barCode',width: 200,title: '产品条形码',fixed: 'left'},
    {field: 'commodityBrand',width: 100,title: '商品品牌',fixed: 'left'},
    {field: 'commodityName',width: 200,title: '商品名称',fixed: 'left'},
    {field: 'vohomePhoto',width: 100,title: '商品图片',fixed: 'left'},
  
    {field: 'batchId',width: 150,title: '批'},
    {field: 'locationId',width: 150,title: '提货点编码'},
    {field: 'theNum',width: 100,title: '入库数量'},
    {field: 'supplierName',width: 200,title: '供应商名称'},
    {field: 'supplierContact',width: 200,title: '供应商的联系'},
    {field: 'supplierPhone',width: 200,title: '供应商的电话'},
    {field: 'averagePrice',width: 200,title: '入库平均价格'},
    {field: 'expireTime',width: 200,title: '保质期'},
    {field: 'comment',width: 200,title: '备注'},
    {field: 'createId',width: 150,title: '操作人员'},
    {field: 'createTime',width: 200,title: '入库时间'},
    {field: 'commodityId',width: 150,title: '商品id'},
    {field: 'merchantNumber',width: 100,title: '商户数量'},
    {field: 'commodityNumber',width: 200,title: '商品编码'}
    
	]
],
data: tableArray,
size: 'lg',
even: true,
page: true,
done:function(){
	 //图片点击放大
    TopimgFn();
}

});


	})//调用接口结束
	
}

table.on('tool(table100)', function(obj) {
	var data = obj.data;
	if(obj.event === 'DelThis') {
		//								      layer.msg('ID：'+ data.id + ' 的查看操作');
		layer.confirm('是否删除该条信息', function(index) {
			AjaxPostFn('system/repository/in/delete', "{'id':'" + data.id + "'}", function(jsonData) {
				if(jsonData.htmlState.status == 200) {
					layer.msg("删除成功");

				} else {}
			})
			AjaxPostFn('system/repository/delete', "{'id':'" + data.id + "'}", function(jsonData) {
				if(jsonData.htmlState.status == 200) {
				

				} else {}
			})
			
			
			obj.del();
			layer.close(index);

		});
	}
})//表格内按钮点击事件结束
$('.openwinbtn').on('click', function() {
    var othis = $(this),
        method = othis.data('method');
    active[method] ? active[method].call(this, othis) : '';
});
		                
var active = {
//    弹出框事件
    addmang:function(){
    	//iframe层-父子操作

		var addindex = layer.open({
		  type: 2,
		  title:"采购入库单录入",
		  area: ['100%', '100%'],
		  maxmin: true,
		  shade: 0,
		  content: 'stock_in.html'
		});
		
		
    	
    	
    	
//      layer.open({
//      	type: 1, 
//          skin: 'layui-layer-molv',
//          title: '新增采购入库',
//          area: ['700px', '400px'],
//          content: $("#addBox").html(),
//          skin: 'demo-class',
//          btn: ["确认新增", "关闭"],
//          yes: function(index, layero) {
//              //按钮1的回调
//              var thisdata = $("#addform").serializeJson();
//             	AjaxPostFn('system/repository/in/insert', JSON.stringify(thisdata), function(jsonData) {
//                  if(jsonData.htmlState.status == 200) {
//	                    layer.msg("增加成功");
//	                    location.reload();
//                    }
//              })
//          },
//          btn2: function(index, layero) {
//              //按钮2的回调
//          },
//          cancel: function() {
//              //右上关闭的回调
//          },success:function(){
//          	//下拉菜单选项
//          	form.render();
//           
//          }
//      })
    }
}
})
</script>
</div>
 <!---------------- 内容 end ---------------->
</div>
</body>
</html>